var i = require("../../../../@babel/runtime/helpers/objectSpread2"), e = getApp();

Component({
    properties: {
        invoiceType: {
            type: [ String, Number ],
            value: 1
        },
        orderList: {
            type: Array,
            value: []
        },
        sinvoice: {
            type: Object,
            value: {}
        },
        loading: {
            type: Boolean,
            value: !1
        },
        finshed: {
            type: Boolean,
            value: !1
        }
    },
    data: {
        visibilityPopup: !1,
        invoice_list: null,
        order_id: "",
        order_item: null,
        showAddressList: !1
    },
    lifetimes: {
        attached: function() {
            this._initData();
        }
    },
    methods: {
        _initData: function() {
            this.setData({
                visibilityPopup: !1,
                invoice_list: null,
                order_id: "",
                showAddressList: !1
            });
        },
        showEditInvoice: function(i) {
            this.setData({
                order_item: i.detail.order_item,
                order_id: i.detail.order_item.id,
                goods_ids: i.detail.goods_id
            });
            var e = JSON.parse(JSON.stringify(this.data.sinvoice)), t = this.data.order_item.address;
            this.selectComponent(".invoicePop").initData({
                address: t,
                sinvoice: e
            });
        },
        subInvoice: function(t) {
            var s = this;
            this.setData({
                invoice_list: t.detail
            });
            var o = this.data.invoice_list, d = e.getNetAddresss("plugin.invoice.frontend.index.confirm-invoicing");
            e._postNetWork({
                url: d,
                data: {
                    data: i({
                        order_id: this.data.order_id,
                        goods_id: this.data.goods_ids
                    }, o)
                },
                success: function(i) {
                    var t = i.data;
                    if (1 != t.result) return e.tips(t.msg);
                    e.tips("申请成功"), s.triggerEvent("addSuccess"), s.selectComponent(".invoicePop").closePop();
                }
            });
        },
        invoiceShowAddressFun: function() {
            this.setData({
                showAddressList: !0
            });
        },
        confirmSelectAddress: function(i) {
            var e = i.detail.loc ? i.detail.form : i.detail;
            this.selectComponent(".invoicePop").setAddress(e), this.setData({
                showAddressList: !1
            });
        }
    }
});